---
title: transformScale
description: Transform a Dinero object to a new scale.
returns: Dinero<TAmount>
---

Transform a Dinero object to a new scale.

When transforming to a higher scale, the internal `amount` value increases by orders of magnitude. If you're using the default Dinero.js implementation (with the `number` calculator), be careful not to exceed the minimum and maximum safe integers.

When transforming to a smaller scale, the `amount` loses precision. By default, the function rounds down the amount. You can specify how to round by [passing a custom divide function](#pass-a-custom-divide-function).

For convenience, Dinero.js provides the following divide functions: `up`, `down`, `halfUp`, `halfDown`, `halfOdd`, `halfEven` ([bankers rounding](https://wiki.c2.com/?BankersRounding)), `halfTowardsZero`, and `halfAwayFromZero`.

## Parameters

<Parameters>

<Parameter name="dineroObject" type="Dinero<TAmount>" required={true}>

The Dinero object to transform.

</Parameter>

<Parameter name="newScale" type="TAmount" required={true}>

The new scale.

</Parameter>

<Parameter name="divide" type="DivideOperation" required={false}>

A custom divide function.

</Parameter>

</Parameters>

## Code examples

### Transform an object to a new scale

```js
import { dinero, transformScale } from 'dinero.js';
import { USD } from '@dinero.js/currencies';

const d = dinero({ amount: 500, currency: USD, scale: 2 });

transformScale(d, 4); // a Dinero object with amount 50000 and scale 4
```

### Pass a custom divide function

```js
import { dinero, transformScale, up } from 'dinero.js';
import { USD } from '@dinero.js/currencies';

const d = dinero({ amount: 10455, currency: USD, scale: 3 });

transformScale(d, 2, up); // a Dinero object with amount 1046 and scale 2
```
